import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 食堂菜单信息 */
export interface CanteenMenu {
          id: number; // ID
          canteenSn?: number; // 餐厅ID
          menuSn: string; // 菜单编码
          name?: string; // 名称
          price?: number; // 金额
          img: string; // 图片
          info: string; // 信息
          sort?: number; // 排序
  }

// 食堂菜单 API
export const CanteenMenuApi = {
  // 查询食堂菜单分页
  getCanteenMenuPage: async (params: any) => {
    return await request.get({ url: `/rbt/canteen-menu/page`, params })
  },

  // 查询食堂菜单详情
  getCanteenMenu: async (id: number) => {
    return await request.get({ url: `/rbt/canteen-menu/get?id=` + id })
  },

  // 新增食堂菜单
  createCanteenMenu: async (data: CanteenMenu) => {
    return await request.post({ url: `/rbt/canteen-menu/create`, data })
  },

  // 修改食堂菜单
  updateCanteenMenu: async (data: CanteenMenu) => {
    return await request.put({ url: `/rbt/canteen-menu/update`, data })
  },

  // 删除食堂菜单
  deleteCanteenMenu: async (id: number) => {
    return await request.delete({ url: `/rbt/canteen-menu/delete?id=` + id })
  },

  /** 批量删除食堂菜单 */
  deleteCanteenMenuList: async (ids: number[]) => {
    return await request.delete({ url: `/rbt/canteen-menu/delete-list?ids=${ids.join(',')}` })
  },

  // 导出食堂菜单 Excel
  exportCanteenMenu: async (params) => {
    return await request.download({ url: `/rbt/canteen-menu/export-excel`, params })
  }
}
